import {createRouter, createWebHistory} from "vue-router";
import LoginView from "../views/login/LoginView.vue";
import WorkbenchView from "../views/workbench/WorkbenchView.vue";
import PreviewBill from "../views/preview/PreviewBill.vue";
import EditTest from "../views/EditTest.vue";
import SurveysView from "../views/surveys/SurveysView.vue";
import PreviewDev from "../views/preview/PreviewDev.vue";
import ResultView from "../views/preview/ResultView.vue";
import UserManageView from "../views/user/UserManageView.vue";
import UserinfoView from "../views/user/UserinfoView.vue";
import SurveyStatistics from "../views/statistics/SurveyStatistics.vue";
import TemplateManageView from "../views/surveys/TemplateManageView.vue";
import TemplateView from "../views/surveys/TemplateView.vue";
import TemplateAuditView from "../views/surveys/TemplateAuditView.vue";
import HomeView from "../views/home/HomeView.vue";
import FileManageView from "../views/files/FileManageView.vue";
import IndexView from "../views/home/IndexView.vue";


const routes = [
    {path: '/',redirect:'/index'},
    {path: '/index',component: IndexView},
    {path: '/home',component: HomeView},
    {path: '/login',component:LoginView},
    {path: '/surveys',component:SurveysView},
    {path: '/workbench',component:WorkbenchView},
    {path: '/workbench/:id',component:WorkbenchView},
    {path: '/edittest',component:EditTest},
    {path: '/preview/:id',component:PreviewBill},
    {path: '/statistics/:id',component:SurveyStatistics},
    {path: '/result',component:ResultView},
    {path: '/preview-dev',component:PreviewDev},
    {path: '/userinfo',component:UserinfoView},
    {path: '/template',component:TemplateView},

    //仅管理员可见
    {path: '/template-manage',meta:{role:'admin'},component:TemplateManageView},
    {path: '/template-audit',meta:{role:'admin'},component:TemplateAuditView},
    {path: '/user-manage',meta:{role:'admin'},component:UserManageView},
    {path: '/file-manage',meta:{role:'admin'},component:FileManageView},
]

const  router =  createRouter({
    //选择路由模式 History模式 | hash模式
    history: createWebHistory(),
    routes,
})


export {router,routes}
